package com.ruoyi.web.controller.system;  

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.CivilAreaCasesNumber;
import com.ruoyi.system.service.ICivilAreaCasesNumberService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 民事公益诉讼领域情况Controller
 * 
 * @author ruoyi
 * @date 2025-05-23
 */
@RestController
@RequestMapping("/system/civiNumber")
public class CivilAreaCasesNumberController extends BaseController
{
    @Autowired
    private ICivilAreaCasesNumberService civilAreaCasesNumberService;

    /**
     * 查询民事公益诉讼领域情况列表
     */
    @PreAuthorize("@ss.hasPermi('system:number:list')")
    @GetMapping("/list")
    public TableDataInfo list(CivilAreaCasesNumber civilAreaCasesNumber)
    {
        startPage();
        List<CivilAreaCasesNumber> list = civilAreaCasesNumberService.selectCivilAreaCasesNumberList(civilAreaCasesNumber);
        return getDataTable(list);
    }

    /**
     * 导出民事公益诉讼领域情况列表
     */
    @PreAuthorize("@ss.hasPermi('system:number:export')")
    @Log(title = "民事公益诉讼领域情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CivilAreaCasesNumber civilAreaCasesNumber)
    {
        List<CivilAreaCasesNumber> list = civilAreaCasesNumberService.selectCivilAreaCasesNumberList(civilAreaCasesNumber);
        ExcelUtil<CivilAreaCasesNumber> util = new ExcelUtil<CivilAreaCasesNumber>(CivilAreaCasesNumber.class);
        util.exportExcel(response, list, "民事公益诉讼领域情况数据");
    }

    /**
     * 获取民事公益诉讼领域情况详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:number:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(civilAreaCasesNumberService.selectCivilAreaCasesNumberById(id));
    }

    /**
     * 新增民事公益诉讼领域情况
     */
    @PreAuthorize("@ss.hasPermi('system:number:add')")
    @Log(title = "民事公益诉讼领域情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CivilAreaCasesNumber civilAreaCasesNumber)
    {
        return toAjax(civilAreaCasesNumberService.insertCivilAreaCasesNumber(civilAreaCasesNumber));
    }

    /**
     * 修改民事公益诉讼领域情况
     */
    @PreAuthorize("@ss.hasPermi('system:number:edit')")
    @Log(title = "民事公益诉讼领域情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CivilAreaCasesNumber civilAreaCasesNumber)
    {
        return toAjax(civilAreaCasesNumberService.updateCivilAreaCasesNumber(civilAreaCasesNumber));
    }

    /**
     * 删除民事公益诉讼领域情况
     */
    @PreAuthorize("@ss.hasPermi('system:number:remove')")
    @Log(title = "民事公益诉讼领域情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(civilAreaCasesNumberService.deleteCivilAreaCasesNumberByIds(ids));
    }
}
